Integrating CodeFusion APIs
Once your CodeFusion scripts are published, they can be exposed as APIs and used in Active Content designs across all channels—email, web, mobile, and more.
Integrating CodeFusion APIs unlocks powerful, dynamic content scenarios. Marketers and developers can use these APIs as data sources in the Active Content builder, mapping script outputs to dynamic content blocks, personalization fields, and logic branches.
To integrate a CodeFusion API in Active Content:
- On the API integration page, click + Create API integration.
-
Select CodeFusion API and fill in the required details:
-
API Name: A clear, business-descriptive name.
-
API Description: Briefly explain what this API delivers or how it should be used.
-
CodeFusion Script: Choose from the dropdown of published scripts. The scripts displayed here were created and published using the CodeFusion interface.
-
- In the API input parameters area, all the inputs of the script are displayed. Specify the values for input parameters.
- Click Execute CodeFusion. The sample JSON is displayed. The following is an example response for the API details you specified:
- (Conditional) If you select Single response, perform the following in the sample JSON:
- Select the checkboxes corresponding the key-value pairs you want to add.
- Click Add output field manually. Specify the attribute path and click
. The attribute is added to the list in the Attributes Selected from API area
- In the Attributes Selected from API area, review the attributes you have selected from the API response. Modify the attribute name if you want. You can click
to remove the selected attribute.
- (Conditional) If you select Multi response, Array element path is displayed in the sample JSON. Perform the following in the sample JSON:
- Select the list which is present at any level in the sample JSON.
- Click Use this array. Array element path is displayed with the selected element.
- Select the checkboxes corresponding the key-value pairs you want to add.
- Click Add output field manually. Specify the attribute path and click
. The attribute is added to the list in the Attributes Selected from API area
- In the Attributes Selected from API area, review the attributes you have selected from the API response. Modify the attribute name if you want. You can click
to remove the selected attribute.
- Click Save.
The Create API integration window is displayed.
The CodeFusion API is now available in the API Integration page and can be added as a data source in Active Content.
You can use the output parameters as Merge Tags in Active Content. This API will be available in the list of APIs when you configure API integrations in Active Content.
For more information on using the CodeFusion API output parameters, see API Integration in Active Content creation.